﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace proj1
{
    class Invoice
    {
        private decimal subtotal;
        private decimal tax;
        private decimal total;
        private item item1, item2, item3;
        private const double rate = 0.098; 
        public Invoice(decimal prc1, decimal prc2, decimal prc3)
        {
            item1 = new item(prc1);
            item2 = new item(prc2);
            item3 = new item(prc3);
        }
        public void set_quantity(int qu1, int qu2, int qu3)
        {
            item1.set_quantity(qu1);
            item2.set_quantity(qu2);
            item3.set_quantity(qu3);

        }
        public void calculate()
        {
            subtotal = item1.get_price() * item1.get_quantity() +
                       item2.get_price() * item2.get_quantity() +
                       item3.get_price() * item3.get_quantity();
            tax = (decimal)rate * subtotal;
            total = tax + subtotal;
            return;
        }

        public decimal get_subtotal()
        {
            return subtotal;
        }
        public decimal get_tax()
        {
            return tax;
        }
        public decimal get_total()
        {
            return total;
        }

    }

}
